﻿package Chapter02;

import java.util.Scanner;

// 供 Ch02GuessGame 和 Ch02Guess1A2B 所使用的 Player 類別
// 負責猜數字的工作
public class Player {
	int intNumber = 0;
	String strNumber = "";

	// 隨機產生要猜的數字
	public void guessByRandom() {
		intNumber = (int)(Math.random() * 10);
		
		System.out.println("I'm guessing "+intNumber);
	}
	
	// 人工輸入要猜的數字
	public void guessByInput() {
		System.out.print("please input some number: ");
		Scanner input = new Scanner(System.in);
		strNumber = input.next();
		
		System.out.println("I'm guessing "+strNumber);
	}
}
